package com.github.maojx0630.easy.translate.translate.impl.dict;

import cn.hutool.core.util.StrUtil;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @author 毛家兴
 * @since 2024-02-06 09:50
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "easy-translate.dict-config")
public class DictConfig {

  /** 字典类型字段名 */
  private String type = "`TYPE`";

  /** 字典标签字段名 */
  private String label = "`LABEL`";

  /** 字典值字段名 */
  private String value = "`VALUE`";

  /** 字典表名 */
  private String table = "sys_dict";

  public void check() {
    if (StrUtil.hasBlank(type, label, value, table)) {
      throw new RuntimeException("字典配置不能为空");
    }
  }
}
